package com.miboxlabs.esecure.ui;
import com.miboxlabs.esecure.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;


public class SplashScreen extends Activity {
	protected boolean _active = true;
	protected int _splashTime = 500;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {

		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);
		// thread for displaying the SplashScreen
		Thread splashTread = new Thread() {
			@Override
			public void run() {
				try {
					int waited = 0;
					while (_active && (waited < _splashTime)) {
						sleep(100);
						if (_active) {
							waited += 100;
						}
					}

				} catch (InterruptedException e) {
					// do nothing
				} finally {
					Intent i = new Intent(SplashScreen.this, Applauncher.class);
					startActivity(i);
					finish();
					stop();
				}
			}
		};
		splashTread.start();
	}

}